<html xmlns:th="http://www.thymeleaf.org">
<head lang="zh_CN" >
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>登录</title>
    <link rel="stylesheet" th:href="@{/css/login.css}" media="all">
    <link rel="stylesheet" th:href="@{/plugins/layui/css/layui.css}" media="all">
</head>
<body class="login-bg">
<div class="login" style="min-height: 250px;">
    <div class="message">请请输入提取码</div>
    <div id="darkbannerwrap"></div>
    <form method="post" class="layui-form" action="/share/file/login">
        <table>
            <tr>
                <td>
                    <input name="extract" placeholder="提取码" type="text" lay-verify="required" class="layui-input">
                    <input type="hidden" name="md5" th:value="${md5}">
                </td>
                <td style="padding-left: 10px;">
                    <input class="loginin" value="提取文件" lay-submit lay-filter="login" type="submit">
                </td>
            </tr>
            <tr>
                <td colspan="2" id="errorTd"></td>
            </tr>
        </table>
    </form>
</div>
<script th:src="@{/plugins/layui/layui.js}"></script>
<script type="text/javascript">
    layui.use(['form','jquery','layer'], function(){
        var form = layui.form,
            $=layui.jquery,
            layer=layui.layer;
        form.on('submit(login)', function(data){
            $.post("/share/file/login", data.field, function(result) {
                if(result.state === 200){
                    location.href='/share/page/' + data.field.md5;
                }else{
                    $('#errorTd').html(result.msg);
                }
            });
            return false;
        });
    });
</script>
</body>
</html>